package com.bianguo.android.bprinter.view.activity;

import android.support.annotation.Nullable;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.style.ImageSpan;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;

import com.bianguo.android.baselibrary.view.BaseActivity;
import com.bianguo.android.bprinter.R;
import com.bianguo.android.ioclibrary.annotations.BindView;
import com.bianguo.android.ioclibrary.annotations.OnClick;

public class DesignActivity extends BaseActivity {

    @BindView(R.id.design_toolbar)
    Toolbar mToolbar;
    @BindView(R.id.design_test_tv)
    TextView testTv;

    @Override
    protected int layoutId() {
        return R.layout.activity_design;
    }

    @Override
    protected void initView(@Nullable Bundle savedInstanceState) {
        setSupportActionBar(mToolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        ImageSpan is = new ImageSpan(this, R.drawable.d_haixiu);
        SpannableString ss = new SpannableString(" 我们都有一个家名字叫中国，兄弟姐妹都很多真呀真不错!\n我们都有一个家名字叫中国，兄弟姐妹都很多真呀真不错!\n我们都有一个家名字叫中国，兄弟姐妹都很多真呀真不错!");
        ss.setSpan(is, 0, 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        testTv.setText(ss);
    }

    @OnClick({R.id.design_finish_ib})
    public void onClickBK(View view) {
        switch (view.getId()) {
            case R.id.design_finish_ib:
                onBackPressed();
                break;
        }
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                onBackPressed();
                return true;
        }
        return super.onOptionsItemSelected(item);
    }
}
